﻿using FS.Common.DotNetBean;
using FS.Common.DotNetCode;
using FS.Common.DotNetUI;
using FS.Business;
using System;
using System.Collections;
using System.Data;

namespace FS.Web.BLL.Visa_info
{
    public partial class Visa_InfoPostForm : PageBase
    {
        private string _key;
        private visa_dao _visa = new visa_dao();
        protected void Page_Load(object sender, EventArgs e)
        {
            this._key = base.Request["key"];
            if (!base.IsPostBack)
            {                
                if (!string.IsNullOrEmpty(this._key))
                {
                    this.InitData();
                    this.GetSelect_postby();
                }
            }
        }

        private void InitData()
        {
            string ls_cus = _visa.GetVisaDetailForm(this._key);
            this.customer.Value = ls_cus;
        }

        //寄件类型
        private void GetSelect_postby()
        {
            DataTable dt = _visa.GetSelect_postby();
            ControlBindHelper.BindHtmlSelect(dt, this.Ref_Postby, "property_value", "property_key", "");
        }
        protected void Save_Click(object sender, EventArgs e)
        {                        
            string ls_posyby = this.Ref_Postby.Value.Trim();
            string ls_postmoney = this.Postmoney.Value;
            string ls_postno = this.PostNo.Value.Trim();
            string ls_postrmk = this.Post_Remark.Value.Trim();

            int rtn = _visa.UpdateInfoPostForm(this._key, ls_posyby, ls_postmoney, ls_postno, ls_postrmk,
                    _userid,_username,_disname);
            if (rtn>0)
            {
                ShowMsgHelper.AlertMsg("操作成功！");
            }
            else
            {
                ShowMsgHelper.Alert_Error("操作失败！");
            }
        }
    }
}